package br.mercadofacil.app.hma;

import com.google.ads.AdRequest;
import com.google.ads.AdView;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageButton;

public class Lista_Pereciveis extends Activity {


	String Bacon="";
	String Camarao="";
	String CBovina="";
	String CSuina="";
	String Coalhada="";
	String Congelados="";
	String FBiologico="";
	String Frango="";
	String Hamburger="";
	String Linguica="";
	String Mortadela="";
	String Peixe="";
	String PdeFrutas="";
	String Presunto="";	
	String Queijo="";
	String Salame="";
	String Salsicha="";
	String TomateSeco="";
	String Apresuntado="";
	String Iogurte="";
	
	private CheckBox chbBacon,chbCamarao,chbCBovina,chbCSuina,chbCoalhada,chbCongelados,chbFBiologico,chbFrango,chbHamburger,
	chbLinguica,chbMortadela,chbPeixe,chbPdeFrutas,chbPresunto,chbQueijo,chbSalame,chbSalsicha,chbTomateSeco,
	chbApresuntado,chbIogurte;
	
	public static final String PREFS_NAME = "SharedPrefsDemoPreferences";
	private SharedPreferences mPrefs;
	
	
	public static final String PREF_BOOL117 = "PrefBool117";
	public static final String PREF_BOOL118 = "PrefBool118";
	public static final String PREF_BOOL119 = "PrefBool119";
	public static final String PREF_BOOL120 = "PrefBool120";
	public static final String PREF_BOOL121 = "PrefBool121";
	public static final String PREF_BOOL122 = "PrefBool122";
	public static final String PREF_BOOL123 = "PrefBool123";
	public static final String PREF_BOOL124 = "PrefBool124";
	public static final String PREF_BOOL125 = "PrefBool125";
	public static final String PREF_BOOL126 = "PrefBool1126";
	public static final String PREF_BOOL127 = "PrefBool1127";
	public static final String PREF_BOOL128 = "PrefBool128";
	public static final String PREF_BOOL129 = "PrefBool129";
	public static final String PREF_BOOL130 = "PrefBool130";
	public static final String PREF_BOOL131 = "PrefBool131";
	public static final String PREF_BOOL132 = "PrefBool132";
	public static final String PREF_BOOL133 = "PrefBool133";
	public static final String PREF_BOOL134 = "PrefBool134";
	public static final String PREF_BOOL135 = "PrefBool135";
	public static final String PREF_BOOL136 = "PrefBool136";
	
	ImageButton btnPagina7;
	
	public static Object LevaBacon;
	public static Object LevaCamarao;
	public static Object LevaCBovina;
	public static Object LevaCSuina;
	public static Object LevaCoalhada;
	public static Object LevaCongelados;
	public static Object LevaFBiologico;
	public static Object LevaFrango;
	public static Object LevaHamburger;
	public static Object LevaLinguica;
	public static Object LevaMortadela;
	public static Object LevaPeixe;
	public static Object LevaPdeFrutas;
	public static Object LevaPresunto;
	public static Object LevaQueijo;
	public static Object LevaSalame;
	public static Object LevaSalsicha;
	public static Object LevaTomateSeco;
	public static Object LevaApresuntado;
	public static Object LevaIogurte;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.aba_pereciveis);
		
		AdView adView5 = (AdView)this.findViewById(R.id.adView5);  
		adView5.loadAd(new AdRequest());
		
		mPrefs = getSharedPreferences(PREFS_NAME, 0);
		
		chbApresuntado = (CheckBox) findViewById(R.id.checkBoxApresentudo);
		chbBacon = (CheckBox) findViewById(R.id.checkBoxBacon);
		chbCamarao = (CheckBox) findViewById(R.id.checkBoxCamarao);
		chbCBovina = (CheckBox) findViewById(R.id.checkBoxCBovina);
		chbCoalhada = (CheckBox) findViewById(R.id.checkBoxCoalhada);
		chbCongelados = (CheckBox) findViewById(R.id.checkBoxCongelados);
		chbCSuina = (CheckBox) findViewById(R.id.checkBoxCSuina);
		chbFBiologico = (CheckBox) findViewById(R.id.checkBoxFBiologico);
		chbFrango = (CheckBox) findViewById(R.id.checkBoxFrango);
		chbHamburger = (CheckBox) findViewById(R.id.checkBoxHamburger);
		chbIogurte = (CheckBox) findViewById(R.id.checkBoxIogurte);
		chbLinguica = (CheckBox) findViewById(R.id.checkBoxLinguica);
		chbMortadela = (CheckBox) findViewById(R.id.checkBoxMortadela);
		chbPdeFrutas = (CheckBox) findViewById(R.id.checkBoxPolpaFrutas);
		chbPeixe = (CheckBox) findViewById(R.id.checkBoxPeixe);
		chbPresunto = (CheckBox) findViewById(R.id.checkBoxPresunto);
		chbQueijo = (CheckBox) findViewById(R.id.checkBoxQueijo);
		chbSalame = (CheckBox) findViewById(R.id.checkBoxSalame);
		chbSalsicha = (CheckBox) findViewById(R.id.checkBoxSalsicha);
		chbTomateSeco = (CheckBox) findViewById(R.id.checkBoxTomateSeco);
		
		btnPagina7 = (ImageButton) findViewById(R.id.btnPagina7);
		
		btnPagina7.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
				if (chbApresuntado.isChecked()) {
					Apresuntado = "Apresuntado";

				}
				if (chbBacon.isChecked()) {
					Bacon = "Bacon";

				}
				if (chbCamarao.isChecked()) {
					Camarao = "Camar‹o";

				}
				if (chbCBovina.isChecked()) {
					CBovina = "Carne Bovina";

				}
				if (chbCoalhada.isChecked()) {
					Coalhada = "Coalhada";

				}
				if (chbCongelados.isChecked()) {
					Congelados = "Congelados";

				}
				if (chbCSuina.isChecked()) {
					CSuina = "Carne Suina";

				}
				if (chbFBiologico.isChecked()) {
					FBiologico = "Fermento Biologico";

				}
				if (chbFrango.isChecked()) {
					Frango = "Frango";

				}
				if (chbHamburger.isChecked()) {
					Hamburger = "Hamburger";

				}
				if (chbIogurte.isChecked()) {
					Iogurte = "Iogurte";

				}
				if (chbLinguica.isChecked()) {
					Linguica = "Lingui�a";

				}
				if (chbMortadela.isChecked()) {
					Mortadela = "Mortadela";

				}
				if (chbPdeFrutas.isChecked()) {
					PdeFrutas = "Polpa de Frutas";

				}
				if (chbPeixe.isChecked()) {
					Peixe = "Peixe";

				}
				if (chbPresunto.isChecked()) {
					Presunto = "Presunto";

				}
				if (chbQueijo.isChecked()) {
					Queijo = "Queijo";

				}
				if (chbSalame.isChecked()) {
					Salame = "Salame";

				}
				if (chbSalsicha.isChecked()) {
					Salsicha = "Salsicha";

				}
				if (chbTomateSeco.isChecked()) {
					TomateSeco = "Tomate Seco";

				}
				
				LevaApresuntado=Apresuntado;
				LevaBacon=Bacon;
				LevaCamarao=Camarao;
				LevaCBovina=CBovina;
				LevaCoalhada=Coalhada;
				LevaCongelados=Congelados;
				LevaCSuina=CSuina;
				LevaFBiologico=FBiologico;
				LevaFrango=Frango;
				LevaHamburger=Hamburger;
				LevaIogurte=Iogurte;
				LevaLinguica=Linguica;
				LevaMortadela=Mortadela;
				LevaPdeFrutas=PdeFrutas;
				LevaPeixe=Peixe;
				LevaPresunto=Presunto;
				LevaQueijo=Queijo;
				LevaSalame=Salame;
				LevaSalsicha=Salsicha;
				LevaTomateSeco=TomateSeco;
				
				startActivity(new Intent(Lista_Pereciveis.this, Lista_Utilidades.class));
				
			}
		});


	}
	
	@Override
	protected void onResume() {

		chbApresuntado.setChecked(mPrefs.getBoolean(PREF_BOOL117, false));
		chbBacon.setChecked(mPrefs.getBoolean(PREF_BOOL118, false));
		chbCamarao.setChecked(mPrefs.getBoolean(PREF_BOOL119, false));
		chbCBovina.setChecked(mPrefs.getBoolean(PREF_BOOL120, false));
		chbCoalhada.setChecked(mPrefs.getBoolean(PREF_BOOL121, false));
		chbCongelados.setChecked(mPrefs.getBoolean(PREF_BOOL122, false));
		chbCSuina.setChecked(mPrefs.getBoolean(PREF_BOOL123, false));
		chbFBiologico.setChecked(mPrefs.getBoolean(PREF_BOOL124, false));
		chbFrango.setChecked(mPrefs.getBoolean(PREF_BOOL125, false));
		chbHamburger.setChecked(mPrefs.getBoolean(PREF_BOOL126, false));
		chbIogurte.setChecked(mPrefs.getBoolean(PREF_BOOL127, false));
		chbLinguica.setChecked(mPrefs.getBoolean(PREF_BOOL128, false));
		chbMortadela.setChecked(mPrefs.getBoolean(PREF_BOOL129, false));
		chbPdeFrutas.setChecked(mPrefs.getBoolean(PREF_BOOL130, false));
		chbPeixe.setChecked(mPrefs.getBoolean(PREF_BOOL131, false));
		chbPresunto.setChecked(mPrefs.getBoolean(PREF_BOOL132, false));
		chbQueijo.setChecked(mPrefs.getBoolean(PREF_BOOL133, false));
		chbSalame.setChecked(mPrefs.getBoolean(PREF_BOOL134, false));
		chbSalsicha.setChecked(mPrefs.getBoolean(PREF_BOOL135, false));
		chbTomateSeco.setChecked(mPrefs.getBoolean(PREF_BOOL136, false));
		

		super.onResume();
	}
	
	@Override
	protected void onPause() {
		Editor e = mPrefs.edit();
		e.putBoolean(PREF_BOOL117, chbApresuntado.isChecked());
		e.putBoolean(PREF_BOOL118, chbBacon.isChecked());
		e.putBoolean(PREF_BOOL119, chbCamarao.isChecked());
		e.putBoolean(PREF_BOOL120, chbCBovina.isChecked());
		e.putBoolean(PREF_BOOL121, chbCoalhada.isChecked());
		e.putBoolean(PREF_BOOL122, chbCongelados.isChecked());
		e.putBoolean(PREF_BOOL123, chbCSuina.isChecked());
		e.putBoolean(PREF_BOOL124, chbFBiologico.isChecked());
		e.putBoolean(PREF_BOOL125, chbFrango.isChecked());
		e.putBoolean(PREF_BOOL126, chbHamburger.isChecked());
		e.putBoolean(PREF_BOOL127, chbIogurte.isChecked());
		e.putBoolean(PREF_BOOL128, chbLinguica.isChecked());
		e.putBoolean(PREF_BOOL129, chbMortadela.isChecked());
		e.putBoolean(PREF_BOOL130, chbPdeFrutas.isChecked());
		e.putBoolean(PREF_BOOL131, chbPeixe.isChecked());
		e.putBoolean(PREF_BOOL132, chbPresunto.isChecked());
		e.putBoolean(PREF_BOOL133, chbQueijo.isChecked());
		e.putBoolean(PREF_BOOL134, chbSalame.isChecked());
		e.putBoolean(PREF_BOOL135, chbSalsicha.isChecked());
		e.putBoolean(PREF_BOOL136, chbTomateSeco.isChecked());
		

		e.commit();
		super.onPause();
	}
}
